package com.ChenYaRou.www.controller;

import com.ChenYaRou.www.constant.JsonBeanConstant;
import com.ChenYaRou.www.utils.JsonBean;
import com.ChenYaRou.www.utils.SensitiveFilter;

import static com.ChenYaRou.www.constant.False.EMPTY;

/**
 * @ClassName SensitiveWordServletController
 * @Description TODO
 * @Author 86183
 * @Date 2022/5/7 7:27
 * @Version 1.0
 **/
public class SensitiveWordServletController {
    /**
     * 是否拥有敏感词
     * @param content
     * @return
     */
    public String hasSensitiveWord(String content){
        if(content==null ||EMPTY.equals(content.trim())){
            return JsonBean.operateList(JsonBeanConstant.FRONT_ERROR,null);
        }
        String sensitiveFilter = SensitiveFilter.getInstance().sensitiveFilter(content);
        if(sensitiveFilter!=null){
            return sensitiveFilter;
        }
        return JsonBean.generateJson(JsonBeanConstant.GET,JsonBeanConstant.SUCCESS,null);
    }
}
